package actions;

import extra.Position;

import constants.*;
import universe.Universe;
import interfaces.impl.Action;

public class ActionTeleport extends Action{
	
	private double x;
	private double y;
	
	public ActionTeleport(int priority){
		super(priority);
		this.id=Constants.ACTION_TELEPORT;
	}
	public ActionTeleport(){
		super();
		this.id=Constants.ACTION_TELEPORT;
	}

	
	@Override
	public boolean processAction(Universe world) {
		
		if(world.isInside(new Position(x,y))){
			target.setPosition(new Position(x,y));
			return true;
		}
		
		return false;
	}

	@Override
	public String getName() {
		
		return "Teleport";
	}
	public double getX() {
		return x;
	}
	public void setX(double x) {
		this.x = x;
	}
	public double getY() {
		return y;
	}
	public void setY(double y) {
		this.y = y;
	}
	public void setPosition(Position p){
		this.x= p.getX();
		this.y =p .getY();
	}
	
	

}
